﻿#IF VER < EncodeVer(5,5,0)
  #error 请升级您的 Inno Setup 编译器到 V5.5.0 或更新的版本
#endif

#ifndef UNICODE
  #error 请使用 Unicode 版 Inno Setup 编译器
#endif

;指定是否为64位安装程序
;#define x64Build

;指定是否只能在 Windows 7 SP1 及更新版本的操作系统上安装
#define Windows7SP1AndNewer

;指定是否要注册相关后缀名
#define RegisteAssociations

;指定是否为绿色版安装程序（仅释放文件，不写入注册表条目，也不生成卸载程序）
;#define PortableBuild

;指定是否只能安装新版本，而不能用旧版本覆盖新版本
#define OnlyInstallNewVersion 

#define MyAppName "SPlayer"
#define MyAppMutex "{B9D31A8E-513D-4BAF-984D-6469FE5543D5}"

#ifdef x64Build
  #define MyAppID "{5306F484-0DB3-4433-A881-6CF1518049A2}"
  #define MyAppExeName "SPlayer64.exe"
#else
  #define MyAppID "{EBCBB421-6900-49A8-ABAF-AEC4FA81FB85}"
  #define MyAppExeName "SPlayer.exe"
#endif

;若想开启禁止安装旧版本的功能，此处版本号请注意一定要是
;点分十进制的正整数，除数字和英文半角句点以外不允许出现任何其他字符，
;否则程序无法判断版本的高低。
#define MyAppVersion "1.0.0.0"
#define MyAppPublisher "wangwenx190"
#define MyAppPublisherURL "https://gitee.com/wangwenx190/SPlayer"
#define MyAppSupportURL MyAppPublisherURL
#define MyAppUpdatesURL MyAppPublisherURL
#define MyAppComments "SPlayer - Enjoy the simple life"
#define MyAppContact MyAppPublisher
#define MyAppSupportPhone "10010102020"
#define MyAppReadmeURL "https://gitee.com/wangwenx190/SPlayer/blob/master/README.md"
#define MyAppLicenseURL "https://gitee.com/wangwenx190/SPlayer/blob/master/LICENSE"
#define MyAppCopyrightYear "2017"
#define MyAppCopyright "版权所有 © " + MyAppCopyrightYear + ", " + MyAppPublisher

[Setup]
AppId={{#MyAppID}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppPublisherURL}
AppSupportURL={#MyAppSupportURL}
AppUpdatesURL={#MyAppUpdatesURL}
AppComments={#MyAppComments}
AppContact={#MyAppContact}
AppSupportPhone={#MyAppSupportPhone}
AppReadmeFile={#MyAppReadmeURL}
AppCopyright={#MyAppCopyright}
DefaultGroupName={#MyAppName}
VersionInfoDescription={#MyAppName} 安装程序
VersionInfoProductName={#MyAppName}
VersionInfoCompany={#MyAppPublisher}
VersionInfoCopyright={#MyAppCopyright}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoProductTextVersion={#MyAppVersion}
VersionInfoTextVersion={#MyAppVersion}
VersionInfoVersion={#MyAppVersion}
OutputDir=.\Output\
SetupIconFile=.\SPlayer.ico
Compression=lzma2/ultra64
InternalCompressLevel=ultra64
SolidCompression=yes
DisableProgramGroupPage=yes
DisableDirPage=yes
DisableReadyMemo=yes
DisableReadyPage=yes
TimeStampsInUTC=yes
SetupMutex={{#MyAppID}Installer,Global\{{#MyAppID}Installer
AppMutex={{#MyAppMutex}
ShowLanguageDialog=no
AllowCancelDuringInstall=no
#ifdef x64Build
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
DefaultDirName={pf64}\{#MyAppPublisher}\{#MyAppName}
#else
ArchitecturesAllowed=x86 x64
DefaultDirName={pf32}\{#MyAppPublisher}\{#MyAppName}
#endif
#ifdef Windows7SP1AndNewer
MinVersion=0,6.1.7600
#else
MinVersion=0,5.1.2600
#endif
#ifdef RegisteAssociations
ChangesAssociations=yes
#else
ChangesAssociations=no
#endif
#ifdef PortableBuild
Uninstallable=no
PrivilegesRequired=lowest
OutputBaseFilename={#MyAppName}_{#MyAppVersion}_Portable
#else
Uninstallable=yes
PrivilegesRequired=admin
#ifdef x64Build
OutputBaseFilename={#MyAppName}64_{#MyAppVersion}_Setup
#else
OutputBaseFilename={#MyAppName}_{#MyAppVersion}_Setup
#endif
UninstallDisplayName={#MyAppName}
UninstallDisplayIcon={uninstallexe},0
#endif

[Languages]
;安装语言为简体中文，还需要其他语言请在此区段添加
Name: "zh_CN"; MessagesFile: ".\lang\zh-CN.isl"

[Files]
;包含项目文件
Source: ".\app\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
;包含所有临时资源文件
Source: ".\tmp\*"; DestDir: "{tmp}"; Flags: dontcopy solidbreak; Attribs: hidden system

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

#ifdef RegisteAssociations
[UninstallRun]
;卸载时运行反注册程序
Filename: "{app}\{#MyAppExeName}"; Parameters: "--unassoc"; WorkingDir: "{app}"; Flags: waituntilterminated skipifdoesntexist
#endif

#ifndef PortableBuild
[UninstallDelete]
;卸载时删除安装目录下的所有文件及文件夹
Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{userappdata}\{#MyAppPublisher}\{#MyAppName}"
#endif

[Code]
//引入脚本区段
#include ".\include\Code.iss"

